package com.he.hsdyc.controller;


import com.he.hsdyc.model.msg.ErrorCode;
import com.he.hsdyc.model.msg.Message;
import com.he.hsdyc.service.MiaoShaService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/miaosha")
public class MiaoShaController {

    private final MiaoShaService miaoShaService;

    @Autowired
    public MiaoShaController(MiaoShaService miaoShaService) {
        this.miaoShaService = miaoShaService;
    }

    @ApiOperation("秒杀测试")
    @RequestMapping(value = "test",method = RequestMethod.GET)
    public Message testDate(@RequestParam Long goodsId) {
        return new Message(ErrorCode.SUCCESS,miaoShaService.miaosha(goodsId));
    }

}
